#pragma once
#include <iostream>
#include <string>
using namespace std;

struct A
{
    A(string s1) { cout << s1 << endl; }
};

struct B : virtual public A
{
    B(string s1, string s2)
        : A(s1)
    {
        cout << s2 << endl;
    }
};

struct C : virtual public A
{
    C(string s1, string s2)
        : A(s1)
    {
        cout << s2 << endl;
    }
};

struct D : public B, public C
{
    D(string s1, string s2, string s3, string s4)
        : C(s1, s2)
        , B(s1, s3)
        , A(s1)
    {
        cout << s4 << endl;
    }
};

void test_9()
{
    D* pd = new D("A", "B", "C", "D");
    delete pd;
}